package com.jt9003.service.impl;

import com.jt9003.dao.UsageMapper;
import com.jt9003.pojo.Usage;
import com.jt9003.pojo.User1;
import com.jt9003.service.UsageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UsageServiceImpl implements UsageService {
    @Resource
    private UsageMapper usageMapper;
    //增加用法
    @Override
    public int insertUsage(String usageName) {
     int i=usageMapper.insertUsage(usageName);
        return i;
    }

    //根据Id删除用法
    @Override
    public int deleteUsageById(int usageId) {
        int i=usageMapper.deleteUsageById(usageId);
        return i;
    }

    //根据Id修改用法
    @Override
    public int updateUsageById(Usage usage) {
        int i=usageMapper.updateUsageById(usage);
        return i;
    }

    //根据Id修改用法状态
    @Override
    public int updateUsageStateById(Usage usage) {
        int i=usageMapper.updateUsageStateById(usage);
        return i;
    }

    //根据用法的名称或拼音首字母进行查询
    @Override
    public List<Usage> selectUsageByNameOrPinyinInitials(String usageName,Integer start, Integer limit) {
        List<Usage> list=usageMapper.selectUsageByNameOrPinyinInitials(usageName,start,limit);
        return list;
    }
    //根据用法的名称或拼音首字母进行查询数量
    @Override
    public int getUsageCountByResult(String usageName) {
        int i=usageMapper.getUsageCountByResult(usageName);
        return i;
    }

    //直接查询所有用法
    @Override
    public List<Usage> selectUsageList(Integer start,Integer limit) {
        List<Usage> list=usageMapper.selectUsageList(start,limit);
        return list;
    }

    @Override
    public int deleteUsagesById(List<Integer>idList) {
        int i=usageMapper.deleteUsagesById(idList);
        return i;
    }

    @Override
    public int getUsageCount() {
        int i=usageMapper.getUsageCount();
        return i;
    }
}
